#include <cmath>
#include <iostream>
#define LL long long
using namespace std;

const int kMaxN = 1e5 + 10;
const LL kInf = 1e18;

LL f[kMaxN][2];
int a[kMaxN];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  LL ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  f[0][1] = 0, f[0][0] = -kInf;
  for (int i = 1; i < n; i++) {
    f[i][0] = abs(a[i] - a[i - 1]) + f[i - 1][1];
    f[i][1] = max(0LL, f[i - 1][0] - abs(a[i] - a[i - 1]));
    ans = max(ans, max(f[i][0], f[i][1]));
  }
  cout << ans << "\n";
  return 0;
}